<template>
  <el-card>
    <template #header>
      <div class="clearfix">
        <span>充电桩列表</span>
        <el-button @click="router.push('/home/partner/investors/add')" style="float: right; padding: 3px 0" type="text">添加</el-button>
      </div>
    </template>
    <el-table :data="chargingPilesList" style="width: 100%">
      <el-table-column prop="id" label="序号"></el-table-column>
      <el-table-column prop="chargerName" label="电桩名称"></el-table-column>
      <el-table-column prop="chargerModel" label="电桩型号" ></el-table-column>
      <el-table-column prop="chargerType" label="电桩类型" ></el-table-column>
      <el-table-column prop="chargerCount" label="充电枪数量"></el-table-column>
      <el-table-column prop="associatedStation" label="关联电站" ></el-table-column>
      <el-table-column prop="power" label="电桩功率" ></el-table-column>
      <el-table-column prop="status" label="状态" >
        <template #default="scope">
          {{ scope.row.status === '上线' ? '上线' : '离线' }}
        </template>
      </el-table-column>
      <el-table-column prop="creationTime" label="创建时间" ></el-table-column>
    </el-table>
  </el-card>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { fetchChargingPilesList } from "../../../../api/ChargingPilesApi.ts";
import router from "../../../../router";

const chargingPilesList = ref([]);

const getChargingPilesList = async () => {
  const res = await fetchChargingPilesList();
  if (res.code === 200) {
    chargingPilesList.value = res.data
  }
};


getChargingPilesList();

</script>

<style scoped>
.el-card {
  margin-top: 20px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: 0 0 0 #ffffff;
  outline: 0;
}
</style>
